package com.chaos.eurekaproducer.utils;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author liaopeng
 * @title: MyThreadPool
 * @projectName eureka-producer
 * @description: TODO
 * @date 2021/5/24下午10:26
 */
public class MyThreadPoolExecutor extends ThreadPoolExecutor {

    public MyThreadPoolExecutor() {
        super(2, 5, 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>());
    }

    @Override
    protected void beforeExecute(Thread t, Runnable r) {
        System.out.println("线程之前执行的操作");
    }

    @Override
    protected void afterExecute(Runnable r, Throwable t) {
        System.out.println("线程之后执行的操作"+t.getMessage());
    }
}
